package vader.api;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author vader
 * @Title: 获取商品策略类
 */
@Component
public class ApiStrategyFactory {
    // 借助spring容器，所有PaymentStrategy的实现类都会注入到map中，key为bean的名字
    @Resource
    private Map<String, ApiStrategy> apiStrategyMap;

    public ApiStrategy getApiStrategy(String key){
        return apiStrategyMap.get(key);
    }
}
